home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 3.3 KB | 98 lines | [TEXT/MPS ] |
- // UCommandHandler.h
- // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
-
- #ifndef __UCOMMANDHANDLER__
- #define __UCOMMANDHANDLER__
-
- // MacApp
-
- #ifndef __UCOMMAND__
- #include "UCommand.h"
- #endif
-
- #ifndef __UEVENTHANDLER__
- #include "UEventHandler.h"
- #endif
-
- //----------------------------------------------------------------------------------------
- // Forward and external class declarations.
- //----------------------------------------------------------------------------------------
-
-
- //----------------------------------------------------------------------------------------
- // The parent class of applications, documents and views.
- // Provides a context for undoable commands
- //----------------------------------------------------------------------------------------
-
- class TCommandHandler : public TEventHandler
- {
- MA_DECLARE_CLASS;
-
- public:
- // TCommand* fLastCommand; // the last undoable command done or undone by the
- // // user in the context of this command handler
-
- static unsigned long fgTransactionIDCount;
-
- unsigned long fPendingActionID;
-
- //------------------------------------------------------------------------------------
- // Initializer, I<Method> and Free.
- //------------------------------------------------------------------------------------
-
- TCommandHandler();
- // Constructor
-
- void ICommandHandler(TEventHandler* itsNextHandler);
- // Call IEventHandler
-
- // virtual TObject* Clone(); // override
- // // Calls Inherited::Clone and then clones owned objects.
-
- virtual ~TCommandHandler();
-
- //------------------------------------------------------------------------------------
- // MenuEvents
- //------------------------------------------------------------------------------------
-
- // virtual void DoMenuCommand(CommandNumber aCommandNumber); // override
- // Handles the Undo menu command
-
- // virtual void HandleSetupMenus(); // override
- // Overridden to adjust the Undo menu
-
- // virtual void SetupUndoMenu();
- // Adjusts the appearance and enabling of the Undo menu.
-
- //------------------------------------------------------------------------------------
- // Command Handling
- //------------------------------------------------------------------------------------
-
- virtual TCommandHandler* GetContext(CommandNumber aCommandNumber);
- // A convenient way to determine the context when initializing a command posted
- // by this CommandHandler. The default returns this. Overridden by TView.
-
- virtual void PerformCommand(TCommand* command);
- // Performs the given command and its linked command by calling
- // DoPerformCommand. This DOES NOT check to see if command is NULL.
-
- // virtual void DoPerformCommand(TCommand* command, Boolean& cmdFreed);
- // // Performs the given command. Called by PerformCommand.
-
- virtual Boolean PerformCommandAppleEvent(TCommand* command);
-
- virtual TCommand* GetLastCommand();
- // Returns the last undoable command. The command returned is not yet committed.
-
- virtual void CommitLastCommand();
- // Clear any commands in the undo/redo stacks.
-
- virtual void PrepareForUndoRedo(TCommand* command);
- // Make this context ready for undo/redo.
-
- virtual void RevealUndoRedo(TCommand* command);
- // Make this context visible after undo/redo.
- };
-
- #endif // __UCOMMANDHANDLER__
-